﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utility.DBUtility.ORM.EntityAttribute
{
    /// <summary>
    /// 数据库表属性标签
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class DbTableAttribute : Attribute
    {
        /// <summary>
        /// 数据库表属性标签
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="hasSoftDelete">是否有软删除</param>
        /// <param name="softDeleteColumn">软删除字段名称</param>
        /// <param name="effectiveValue">有效的值</param>
        /// <param name="softDeleteValue">软删除的值</param>
        public DbTableAttribute(string tableName = ""
                                , bool hasSoftDelete = false
                                , string softDeleteColumn = "FLAG"
                                , string effectiveValue ="1"
                                , string softDeleteValue = "0")
        {
            TableName = tableName;
            HasSoftDelete = hasSoftDelete;
            SoftDeleteColumn = softDeleteColumn;
            SoftDeleteValue = softDeleteValue;
            EffectiveValue = effectiveValue;
        }

        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 是否有软删除栏位
        /// </summary>
        public bool HasSoftDelete { get; set; }
        /// <summary>
        /// 软删除栏位名称
        /// </summary>
        public string SoftDeleteColumn { get; set; }
        /// <summary>
        /// 软删除栏位值
        /// </summary>
        public string SoftDeleteValue { get; set; }
        /// <summary>
        /// 有效的 值
        /// </summary>
        public string EffectiveValue { get; set; }
    }
}
